package com.yitong;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class demo5 {
    public static void main(String[] args) throws IOException {
        //客户端
        Socket s =new Socket("192.168.74.1",1000);

        OutputStream os = s.getOutputStream();

        os.write("我给你发了一条数据，你看看收到没有！".getBytes());

        InputStream is = s.getInputStream();

        byte[] bys = new byte[1024];

        int len = is.read(bys);

        System.out.println("返回的数据："+new String(bys,0,len));
        s.close();
    }
}
